1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module pango.PgCoverage;
26 
27 private import glib.ConstructionException;
28 private import glib.Str;
29 private import glib.c.functions;
30 private import gobject.ObjectG;
31 private import pango.c.functions;
32 public  import pango.c.types;
33 
34 
35 /**
36  * A `PangoCoverage` structure is a map from Unicode characters
37  * to [enum@Pango.CoverageLevel] values.
38  * 
39  * It is often necessary in Pango to determine if a particular
40  * font can represent a particular character, and also how well
41  * it can represent that character. The `PangoCoverage` is a data
42  * structure that is used to represent that information. It is an
43  * opaque structure with no public fields.
44  */
45 public class PgCoverage : ObjectG
46 {
47 	/** the main Gtk struct */
48 	protected PangoCoverage* pangoCoverage;
49 
50 	/** Get the main Gtk struct */
51 	public PangoCoverage* getPgCoverageStruct(bool transferOwnership = false)
52 	{
53 		if (transferOwnership)
54 			ownedRef = false;
55 		return pangoCoverage;
56 	}
57 
58 	/** the main Gtk struct as a void* */
59 	protected override void* getStruct()
60 	{
61 		return cast(void*)pangoCoverage;
62 	}
63 
64 	/**
65 	 * Sets our main struct and passes it to the parent class.
66 	 */
67 	public this (PangoCoverage* pangoCoverage, bool ownedRef = false)
68 	{
69 		this.pangoCoverage = pangoCoverage;
70 		super(cast(GObject*)pangoCoverage, ownedRef);
71 	}
72 
73 
74 	/** */
75 	public static GType getType()
76 	{
77 		return pango_coverage_get_type();
78 	}
79 
80 	/**
81 	 * Create a new `PangoCoverage`
82 	 *
83 	 * Returns: the newly allocated `PangoCoverage`, initialized
84 	 *     to %PANGO_COVERAGE_NONE with a reference count of one, which
85 	 *     should be freed with [method@Pango.Coverage.unref].
86 	 *
87 	 * Throws: ConstructionException GTK+ fails to create the object.
88 	 */
89 	public this()
90 	{
91 		auto __p = pango_coverage_new();
92 
93 		if(__p is null)
94 		{
95 			throw new ConstructionException("null returned by new");
96 		}
97 
98 		this(cast(PangoCoverage*) __p, true);
99 	}
100 
101 	/**
102 	 * Convert data generated from [method@Pango.Coverage.to_bytes]
103 	 * back to a `PangoCoverage`.
104 	 *
105 	 * Deprecated: This returns %NULL
106 	 *
107 	 * Params:
108 	 *     bytes = binary data
109 	 *         representing a `PangoCoverage`
110 	 *
111 	 * Returns: a newly allocated `PangoCoverage`
112 	 */
113 	public static PgCoverage fromBytes(char[] bytes)
114 	{
115 		auto __p = pango_coverage_from_bytes(bytes.ptr, cast(int)bytes.length);
116 
117 		if(__p is null)
118 		{
119 			return null;
120 		}
121 
122 		return ObjectG.getDObject!(PgCoverage)(cast(PangoCoverage*) __p, true);
123 	}
124 
125 	/**
126 	 * Copy an existing `PangoCoverage`.
127 	 *
128 	 * Returns: the newly allocated `PangoCoverage`,
129 	 *     with a reference count of one, which should be freed with
130 	 *     [method@Pango.Coverage.unref].
131 	 */
132 	public PgCoverage copy()
133 	{
134 		auto __p = pango_coverage_copy(pangoCoverage);
135 
136 		if(__p is null)
137 		{
138 			return null;
139 		}
140 
141 		return ObjectG.getDObject!(PgCoverage)(cast(PangoCoverage*) __p, true);
142 	}
143 
144 	/**
145 	 * Determine whether a particular index is covered by @coverage.
146 	 *
147 	 * Params:
148 	 *     index = the index to check
149 	 *
150 	 * Returns: the coverage level of @coverage for character @index_.
151 	 */
152 	public PangoCoverageLevel get(int index)
153 	{
154 		return pango_coverage_get(pangoCoverage, index);
155 	}
156 
157 	/**
158 	 * Set the coverage for each index in @coverage to be the max (better)
159 	 * value of the current coverage for the index and the coverage for
160 	 * the corresponding index in @other.
161 	 *
162 	 * Deprecated: This function does nothing
163 	 *
164 	 * Params:
165 	 *     other = another `PangoCoverage`
166 	 */
167 	public void max(PgCoverage other)
168 	{
169 		pango_coverage_max(pangoCoverage, (other is null) ? null : other.getPgCoverageStruct());
170 	}
171 
172 	alias doref = ref_;
173 	/**
174 	 * Increase the reference count on the `PangoCoverage` by one.
175 	 *
176 	 * Deprecated: Use g_object_ref instead
177 	 *
178 	 * Returns: @coverage
179 	 */
180 	public override PgCoverage ref_()
181 	{
182 		auto __p = pango_coverage_ref(pangoCoverage);
183 
184 		if(__p is null)
185 		{
186 			return null;
187 		}
188 
189 		return ObjectG.getDObject!(PgCoverage)(cast(PangoCoverage*) __p, true);
190 	}
191 
192 	/**
193 	 * Modify a particular index within @coverage
194 	 *
195 	 * Params:
196 	 *     index = the index to modify
197 	 *     level = the new level for @index_
198 	 */
199 	public void set(int index, PangoCoverageLevel level)
200 	{
201 		pango_coverage_set(pangoCoverage, index, level);
202 	}
203 
204 	/**
205 	 * Convert a `PangoCoverage` structure into a flat binary format.
206 	 *
207 	 * Deprecated: This returns %NULL
208 	 *
209 	 * Params:
210 	 *     bytes = location to store result (must be freed with g_free())
211 	 */
212 	public void toBytes(out ubyte[] bytes)
213 	{
214 		ubyte* outbytes;
215 		int nBytes;
216 
217 		pango_coverage_to_bytes(pangoCoverage, cast(char**)&outbytes, &nBytes);
218 
219 		bytes = outbytes[0 .. nBytes];
220 	}
221 
222 	/**
223 	 * Decrease the reference count on the `PangoCoverage` by one.
224 	 *
225 	 * If the result is zero, free the coverage and all associated memory.
226 	 *
227 	 * Deprecated: Use g_object_unref instead
228 	 */
229 	public override void unref()
230 	{
231 		pango_coverage_unref(pangoCoverage);
232 	}
233 }